Repository navigation
fork: green main again (schema-check comments, checkout without submodule cleanup) - #8
Conversation
…dule cleanup) Lint: eight comments in fork-schema-check.cjs were over the four-line cap of t3code/no-low-value-comments. Cut to the constraints; the restating parts and JSDoc type blocks are gone (the file is not type-checked). No database schema changes: actions/checkout with persist-credentials: false runs `git submodule foreach` to remove auth, and upstream's tree has gitlinks under .repos/alchemy-effect/submodules/ with no .gitmodules, so it died with "No url found for submodule path" before any script ran. The job now uses plain git: init, an anonymous blob:none fetch of the default branch, base and head, a sparse checkout of .github at github.sha. Still pull_request_target, still no checkout of PR code, any git error fails the step. Tests: a gitlink with no .gitmodules in the e2e set, and the workflow's own checkout step run against such a repository (plus fail-closed on a missing commit). The workflow shape test now allows only a checkout of github.sha. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot fetch blobs one by one A sparse checkout left every blob the check reads to a separate lazy fetch from the partial clone (about 170 round trips on the real tree), close to the job's five-minute timeout. A full checkout fetches the default branch's blobs in one batch, as actions/checkout did before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Proof for the new fork-checks.yml (
|
|
lens: correctness+security · reviewer: opus high (t3lens-8) · read at: e76c877 covered: full diff origin/main...e76c877 (fork-checks.yml, fork-schema-check.cjs, fork-schema-check.test.cjs), plus what the check calls into (git(), readTree, readBlob, blobAt, staleCommits, main). Compared with upstream's own plain-git checkout in desktop-macos-preview.yml, the proof run 43229342558 (its workflow is byte-identical to this head's except for the trigger, and every step is green; the checkout took 21s), the failing run 43230803534 (main's copy, "No url found for submodule path"), and every actions/checkout use on fork main. My view first: a pull_request_target job that swaps actions/checkout for plain git must guarantee five things. (a) The work tree, and every script that runs, comes from the commit whose workflow is running (github.sha). (b) The PR head only arrives as objects. (c) No credential reaches disk or the remote URL. (d) Event values reach bash only through env. (e) Every fetch or checkout failure exits non-zero. The step does all five:
checks:
finding: minor .github/scripts/fork-schema-check.test.cjs:463 The "event values only via env" guard only scans lines that contain |
Main (ae0d686) is red on two jobs, so every fork PR is red. This fixes both.
1. Lint:
t3code/no-low-value-comments(8 errors)All eight were comments in
.github/scripts/fork-schema-check.cjs(from #3) over the four-line cap. I cut them to the constraint they carry (why barrels are guarded but not followed, why other export entries and dependency specs stay free, why absent/non-JSON manifests get their own value, the file header's list of what is refused). I dropped the parts that restate the code and the long JSDoc type blocks, since the file is not type-checked. The rule is not disabled.vp lintandvp fmt --checkare clean on the three files.2. "No database schema changes": checkout died before any script ran
Exact error (PR #4's run 43226799575, head c861d84), in actions/checkout's own step, under "Removing auth":
persist-credentials: falsemakes actions/checkout remove auth right after checkout, and that runsgit submodule foreach. Upstream's tree has two gitlinks under.repos/alchemy-effect/submodules/and no.gitmodules.submodules: falseis already the default and does not help. A sparse checkout does not help either, becausesubmodule foreachreads gitlinks from the index (checked locally).Fix: the job uses plain git and no checkout action. It runs
git init, then one anonymous--filter=blob:none --no-recurse-submodulesfetch ofgithub.sha(the default branch underpull_request_target), base and head. Then a full checkout ofgithub.sha. A full checkout fetches main's blobs in one batch. A sparse one left the check to fetch each blob it reads separately (64s instead of 1s on the proof run). Git never runs a submodule command.pull_request_target, and still no checkout of PR code: the head is only fetched as objects.env:.set -euo pipefail, so any fetch or checkout error is red. The test covers a commit the remote lacks.Tests
.gitmodules(unchanged, and bumped by the PR) is checked like any other tree and passes.fork-checks.ymland run withbash -eo pipefailthe way Actions does, against a local origin with a gitlink and no.gitmodules. It asserts:Mutation check: adding
git submodule foreach --recursive trueto the step makes this test fail with the exact CI error.actions/checkout,ref:,secrets.orGITHUB_TOKEN, and the onlygit checkout|switch|worktree|reset|read-treeisgit checkout -q --detach "$DEFAULT_SHA"withDEFAULT_SHA: ${{ github.sha }}. The pin test now allows a workflow that uses no actions.node --test .github/scripts/fork-schema-check.test.cjs: 49/49.About this PR's own "No database schema changes" run
It will stay red, for two reasons:
pull_request_targetruns main's copy offork-checks.yml, which still has the broken checkout.The new job is proven separately on a throwaway proof PR. It runs this branch's workflow under
pull_requestagainst a base that already has the new check. The links are in a comment below.State: what happens when this runs again, stops half-way, or meets existing/old/empty state?
git initand fetches by SHA. Nothing carries over, so a re-run does the same thing.ls-treeand diff already treat mode-160000 entries as "no blob", and the new e2e test covers it.Not covered here
fork-release.ymluses actions/checkout withpersist-credentials: falsein three jobs (lines ~99, ~139, ~354), so the same "Removing auth" failure probably hits those on upstream's tree. I did not change or run them.🤖 Generated with Claude Code